import { unref } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';

const { createConfirm } = useMessage();

// 部门API
enum Api {
  queryIdTree = '/sys/sysDepart/queryIdTree',
  searchBy = '/sys/sysDepart/searchBy',
  queryDepartTreeSync = '/sys/sysDepart/queryDepartTreeSync',
}

// 部门用户API
enum DepartUserApi {
  list = '/sys/user/departUserList',
  link = '/sys/user/editSysDepartWithUser',
}

// 部门角色API
enum DepartRoleApi {
  list = '/sys/sysDepartRole/list',
  deleteBatch = '/sys/sysDepartRole/deleteBatch',
}

// 部门角色API
enum BaseMeasuresTaskApi {
  listAll = '/TbBaseMeasuresTask/tbBaseMeasuresTask/listAll',
}

/**
 * 查询所有正常风险排查任务
 */
export const queryBaseMeasuresTaskApi = () =>  {
  return defHttp.get({url: BaseMeasuresTaskApi.listAll});
};

/**
 * 查询部门下的用户信息
 */
export const queryDeptUserListApi = (params) => {
  return defHttp.get({ url: DepartUserApi.list, params });
}
 

/**
 * 获取部门树列表
 */
export const queryDepartTreeSync = (params?) => defHttp.get({ url: Api.queryDepartTreeSync, params });

/**
 * 查询数据，以树结构形式加载所有部门的名称
 */
export const queryIdTree = (params?) => defHttp.get({ url: Api.queryIdTree, params });

/**
 * 根据关键字搜索部门
 */
export const searchByKeywords = (params) => defHttp.get({ url: Api.searchBy, params });

/**
 * 查询部门下的用户信息
 */
export const departUserList = (params) => defHttp.get({ url: DepartUserApi.list, params });

/**
 * 查询部门角色信息
 */
export const departRoleList = (params) => defHttp.get({ url: DepartRoleApi.list, params });
